<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="referrer" content="origin-when-cross-origin" />
    
    
    
    <meta http-equiv="Cache-Control" content="no-transform" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>Timmoc - 博客园</title>
    <link rel="icon" id="favicon" href="https://assets.cnblogs.com/favicon_v3_2.ico" type="image/x-icon" />
    <link rel="canonical" href="https://www.cnblogs.com/timmoc" />
    
    <link rel="stylesheet" href="/css/blog-common.min.css?v=qUD-0_zSYCTI8W757e0jTzd-58xoJoatCW86LftsVpA" />
    

    
        
    <link type="text/css" rel="stylesheet" href="https://www.cnblogs.com/timmoc/custom.css?v=4X/Q5Ya72qqRa72aLrY54e5S&#x2B;F4=" />
    
    <link id="mobile-style" media="only screen and (max-width: 767px)" type="text/css" rel="stylesheet" href="/css/mobile-common.min.css?v=NjJnIg2ndXmoshSBcUyxF6kOyJTJ44pIM16pEa8vFeU" />
    
    <link type="application/rss+xml" rel="alternate" href="https://www.cnblogs.com/timmoc/rss" />
    <link type="application/rsd+xml" rel="EditURI" href="https://www.cnblogs.com/timmoc/rsd.xml" />
    <link type="application/wlwmanifest+xml" rel="wlwmanifest" href="https://www.cnblogs.com/timmoc/wlwmanifest.xml" />
    

    <script>
        var currentBlogId = 809481;
        var currentBlogApp = 'timmoc';
        var isLogined = true;
        var isBlogOwner = true;
        var skinName = 'Custom';
        var visitorUserId = '92c6dabb-7cc5-4f6b-fa91-08dbe74faa0a';
        var hasCustomScript = true;
        window.cb_enable_mathjax = false;
        window.mathEngine = 1;
        window.codeHighlightEngine = 1;
        window.enableCodeLineNumber = true;
        window.codeHighlightTheme = 'cnblogs';
        window.darkModeCodeHighlightTheme = 'vs2015';
        window.isDarkCodeHighlightTheme = false;
        window.isDarkModeCodeHighlightThemeDark = true;
        window.isDisableCodeHighlighter = true;
        window.enableCodeThemeTypeFollowSystem = false;
        window.enableMacStyleCodeBlock = false;
    </script>
    <script src="https://assets.cnblogs.com/scripts/jquery-3.3.1.min.js"></script>
    <script src="https://cdn-www.cnblogs.com/js/blog-common.min.js?v=k7fie2PdQsC8zfaJar8NHfrD-zTE-tc_qaYCvRlPepw"></script>
        <script>updateCustomBlogReferrer();</script>
    
</head>
<body class="skin-custom no-navbar">
    <a name="top"></a>
    <div id="top_nav" class="navbar forpc navbar-custom">
        <nav id="nav_main" class="navbar-main">
            <ul id="nav_left" class="navbar-list navbar-left">
                <li class="navbar-branding">
                    <a href="https://www.cnblogs.com/" title="开发者的网上家园" role="banner">
                        <img src="//assets.cnblogs.com/logo.svg" alt="博客园Logo" />
                    </a>
                </li>
                <li><a href="https://cnblogs.vip/">会员</a></li>
                <li><a href="https://cnblogs.vip/store">周边</a></li>
                    <li><a href="https://cnblogs.vip/donate">捐助</a></li>
                <li>
                    <a href="https://news.cnblogs.com/" onclick="countClicks('nav', 'skin-navbar-news')">新闻</a>
                </li>
                <li>
                    <a href="https://q.cnblogs.com/" onclick="countClicks('nav', 'skin-navbar-q')">博问</a>
                </li>
                <li>
                    <a href="https://ing.cnblogs.com/" onclick="countClicks('nav', 'skin-navbar-ing')">闪存</a>
                </li>
                <li><a href="https://www.cnblogs.com/cmt/p/18341478">赞助商</a></li>
                <li><a href="https://chat2db-ai.com/" target="_blank" onclick="countClicks('nav', 'skin-navbar-chat2db')">Chat2DB</a></li>
            </ul>
            <ul id="nav_right" class="navbar-list navbar-right">
                <li>
                    <form id="zzk_search" class="navbar-search dropdown" action="https://zzk.cnblogs.com/s" method="get" role="search">
                        <input name="w" id="zzk_search_input" placeholder="代码改变世界" type="search" tabindex="3" autocomplete="off" />
                        <button id="zzk_search_button" onclick="window.navbarSearchManager.triggerActiveOption()">
                            <img id="search_icon" class="focus-hidden" src="//assets.cnblogs.com/icons/search.svg" alt="搜索" />
                            <img class="hidden focus-visible" src="//assets.cnblogs.com/icons/enter.svg" alt="搜索" />
                        </button>
                        <ul id="navbar_search_options" class="dropdown-menu quick-search-menu">
                            <li tabindex="0" class="active" onclick="zzkSearch(event, document.getElementById('zzk_search_input').value)">
                                <div class="keyword-wrapper">
                                    <img src="//assets.cnblogs.com/icons/search.svg" alt="搜索" />
                                    <div class="keyword"></div>
                                </div>
                                <span class="search-area">所有博客</span>
                            </li>
                                    <li tabindex="2" onclick="zzkBlogSearch(event, 'timmoc', document.getElementById('zzk_search_input').value)">
                                        <div class="keyword-wrapper">
                                            <img src="//assets.cnblogs.com/icons/search.svg" alt="搜索" />
                                            <div class="keyword"></div>
                                        </div>
                                        <span class="search-area">我的博客</span>
                                    </li>
                        </ul>
                    </form>
                </li>
                <li id="navbar_login_status" class="navbar-list">
                    <a class="navbar-user-info navbar-blog" href="https://i.cnblogs.com/EditPosts.aspx?opt=1" alt="写随笔" title="写随笔">
                        <img id="new_post_icon" class="navbar-icon" src="//assets.cnblogs.com/icons/newpost.svg" alt="写随笔" />
                    </a>
                    <a id="navblog-myblog-icon" class="navbar-user-info navbar-blog" href="https://passport.cnblogs.com/GetBlogApplyStatus.aspx" alt="我的博客" title="我的博客">
                        <img id="myblog_icon" class="navbar-icon" src="//assets.cnblogs.com/icons/myblog.svg" alt="我的博客" />
                    </a>
                    <a class="navbar-user-info navbar-message navbar-icon-wrapper" href="https://msg.cnblogs.com/" alt="短消息" title="短消息">
                        <img id="msg_icon" class="navbar-icon" src="//assets.cnblogs.com/icons/message.svg" alt="短消息" />
                        <span id="msg_count" style="display: none"></span>
                    </a>
                    <a id="navbar_lite_mode_indicator" data-current-page="blog" style="display: none" href="javascript:void(0)" alt="简洁模式" title="简洁模式启用，您在访问他人博客时会使用简洁款皮肤展示">
                        <img class="navbar-icon" src="//assets.cnblogs.com/icons/lite-mode-on.svg" alt="简洁模式" />
                    </a>
                    <div id="user_info" class="navbar-user-info dropdown">
                        <a class="dropdown-button" href="https://home.cnblogs.com/">
                            <img id="user_icon" class="navbar-avatar" src="//assets.cnblogs.com/icons/avatar-default.svg" alt="用户头像" />
                        </a>
                        <div class="dropdown-menu">
                            <a id="navblog-myblog-text" href="https://passport.cnblogs.com/GetBlogApplyStatus.aspx">我的博客</a>
                            <a href="https://home.cnblogs.com/">我的园子</a>
                            <a href="https://account.cnblogs.com/settings/account">账号设置</a>
                            <a href="javascript:void(0)" id="navbar_lite_mode_toggle" title="简洁模式会使用简洁款皮肤显示所有博客">
    简洁模式 <img id="navbar_lite_mode_on" src="/images/lite-mode-check.svg" class="hide" /><span id="navbar_lite_mode_spinner" class="hide">...</span>
</a>
                            <a href="javascript:void(0)" onclick="account.logout();">退出登录</a>
                        </div>
                    </div>
                    <a class="navbar-anonymous" href="https://account.cnblogs.com/signup">注册</a>
                    <a class="navbar-anonymous" href="javascript:void(0);" onclick="account.login()">登录</a>
                </li>
            </ul>
        </nav>
    </div>

    

    <!--done-->
<div id="home">
<div id="header">
	<div id="blogTitle">
        <a id="lnkBlogLogo" href="https://www.cnblogs.com/timmoc/"><img id="blogLogo" src="/skins/custom/images/logo.gif" alt="返回主页" /></a>		
		
<!--done-->
<h1><a id="Header1_HeaderTitle" class="headermaintitle HeaderMainTitle" href="https://www.cnblogs.com/timmoc">Timmoc的技术小屋</a>
</h1>
<h2></h2>




		
	</div><!--end: blogTitle 博客的标题和副标题 -->
	<div id="navigator">
		
<ul id="navList">
<li>
</li>
<li>
<a id="blog_nav_myhome" class="menu" href="https://www.cnblogs.com/timmoc/">
首页</a>
</li>
<li>

<a id="blog_nav_newpost" class="menu" href="https://i.cnblogs.com/EditPosts.aspx?opt=1">
新随笔</a>
</li>
<li>
</li>
<li>

<!--<partial name="./Shared/_XmlLink.cshtml" model="Model" /></li>--></li>
<li>
<a id="blog_nav_admin" class="menu" href="https://i.cnblogs.com/">
管理</a>
</li>
</ul>


		<div class="blogStats">
			<div id="blog_stats_place_holder"><script>loadBlogStats();</script></div>
		</div><!--end: blogStats -->
	</div><!--end: navigator 博客导航栏 -->
</div><!--end: header 头部 -->
<div id="main">
	<div id="mainContent">
	<div class="forFlow">
		





		
<div class="day" role="article" aria-describedby="postlist_description_18628883">
    <div class="dayTitle">
        <a href="https://www.cnblogs.com/timmoc/p/archive/2024/12/25">2024年12月25日
</a>
    </div>

        <div class="postTitle" role="heading" aria-level="2">
            <a class="postTitle2 vertical-middle" href="https://www.cnblogs.com/timmoc/p/18631547">
    <span>
        再战博客园美化
    </span>
    

</a>
        </div>
        <div class="postCon">

<div class="c_b_p_desc" id="postlist_description_18631547">
摘要：        
看一张难蹦的图片 卡片势在必行！ 以上几个有什么区别？ 卡片！！ 不想搬离博客园怎么办 博客园的访问速度比上述两个网站快多了，而且不用担心服务器问题等等 但是自定义怎么弄？ js！ 差不多类似这样，暴力遍历。 然后我一开始用的是ts，就出现了那个名场面 实在难蹦。 我搜了一下，没看到别人遇到过这种问    <a href="https://www.cnblogs.com/timmoc/p/18631547" class="c_b_p_desc_readmore">阅读全文</a>
</div>

</div>
        <div class="clear"></div>
        <div class="postDesc">posted @ 2024-12-25 22:22
Timmoc
<span data-post-id="18631547" class="post-view-count">阅读(6)</span> 
<span data-post-id="18631547" class="post-comment-count">评论(0)</span> 
<span data-post-id="18631547" class="post-digg-count">推荐(0)</span> 
<a href="https://i.cnblogs.com/EditPosts.aspx?postid=18631547" rel="nofollow">
    编辑
</a>
</div>
        <div class="clear"></div>
            <div class="postSeparator"></div>
        <div class="postTitle" role="heading" aria-level="2">
            <a class="postTitle2 vertical-middle" href="https://www.cnblogs.com/timmoc/p/18630787">
    <span>
        h1测试
    </span>
    

</a>
        </div>
        <div class="postCon">

<div class="c_b_p_desc" id="postlist_description_18630787">
摘要：        
h1测试 H1居然还自带了一条线？ h1测试 那我写的这个线谁给我补呢    <a href="https://www.cnblogs.com/timmoc/p/18630787" class="c_b_p_desc_readmore">阅读全文</a>
</div>

</div>
        <div class="clear"></div>
        <div class="postDesc">posted @ 2024-12-25 16:30
Timmoc
<span data-post-id="18630787" class="post-view-count">阅读(10)</span> 
<span data-post-id="18630787" class="post-comment-count">评论(2)</span> 
<span data-post-id="18630787" class="post-digg-count">推荐(0)</span> 
<a href="https://i.cnblogs.com/EditPosts.aspx?postid=18630787" rel="nofollow">
    编辑
</a>
</div>
        <div class="clear"></div>
            <div class="postSeparator"></div>
        <div class="postTitle" role="heading" aria-level="2">
            <a class="postTitle2 vertical-middle" href="https://www.cnblogs.com/timmoc/p/18630701">
    <span>
        python tqdm 进度条尝试
    </span>
    

</a>
        </div>
        <div class="postCon">

<div class="c_b_p_desc" id="postlist_description_18630701">
摘要：        
起因 上期博客（https://www.cnblogs.com/timmoc/p/18630509）不是研究着发现没有进度条还是太不直观了吗 那今天来整个进度条。 好的本篇随笔到此结束 不是这也太水了吧，试着按到上篇博客里面？ 只需要修改worker的代码就好了。 不是不是，等等，我说停停。 合着这    <a href="https://www.cnblogs.com/timmoc/p/18630701" class="c_b_p_desc_readmore">阅读全文</a>
</div>

</div>
        <div class="clear"></div>
        <div class="postDesc">posted @ 2024-12-25 16:24
Timmoc
<span data-post-id="18630701" class="post-view-count">阅读(1)</span> 
<span data-post-id="18630701" class="post-comment-count">评论(0)</span> 
<span data-post-id="18630701" class="post-digg-count">推荐(0)</span> 
<a href="https://i.cnblogs.com/EditPosts.aspx?postid=18630701" rel="nofollow">
    编辑
</a>
</div>
        <div class="clear"></div>
            <div class="postSeparator"></div>
        <div class="postTitle" role="heading" aria-level="2">
            <a class="postTitle2 vertical-middle" href="https://www.cnblogs.com/timmoc/p/18628883">
    <span>
        博客园美化 纯代码部分
    </span>
    

</a>
        </div>
        <div class="postCon">

<div class="c_b_p_desc" id="postlist_description_18628883">
摘要：        
顺便公开一下代码 还能再水一篇 首先是几个一万年下载失败的东西，我替你们下载好了，可以直接引用我发布在博客园的文件，毕竟人人为我，我为人人嘛。 https://files.cnblogs.com/files/blogs/809481/jquery.cookie.js?t=1735051954&amp;dow    <a href="https://www.cnblogs.com/timmoc/p/18628883" class="c_b_p_desc_readmore">阅读全文</a>
</div>

</div>
        <div class="clear"></div>
        <div class="postDesc">posted @ 2024-12-25 15:43
Timmoc
<span data-post-id="18628883" class="post-view-count">阅读(1)</span> 
<span data-post-id="18628883" class="post-comment-count">评论(0)</span> 
<span data-post-id="18628883" class="post-digg-count">推荐(0)</span> 
<a href="https://i.cnblogs.com/EditPosts.aspx?postid=18628883" rel="nofollow">
    编辑
</a>
</div>
        <div class="clear"></div>
</div>


		
<div class="day" role="article" aria-describedby="postlist_description_18628757">
    <div class="dayTitle">
        <a href="https://www.cnblogs.com/timmoc/p/archive/2024/12/24">2024年12月24日
</a>
    </div>

        <div class="postTitle" role="heading" aria-level="2">
            <a class="postTitle2 vertical-middle" href="https://www.cnblogs.com/timmoc/p/18628835">
    <span>
        博客园cnblog美化
    </span>
    

</a>
        </div>
        <div class="postCon">

<div class="c_b_p_desc" id="postlist_description_18628835">
摘要：        
起因 博客园这个丑丑的默认样式实在看不下去，换了一个主题，但是发现这个主题用的人还是太多了 说实话要是给主页的样子其实也还不错啊（广告就不要了谢谢） 改变现状 想来想去，还是得美化一下，但是自己没有这个精力去美化，怎么办呢 自然还是去找别人的模板，先好看起来再说，以后再去想要不要修改，要不要变得更好    <a href="https://www.cnblogs.com/timmoc/p/18628835" class="c_b_p_desc_readmore">阅读全文</a>
</div>

</div>
        <div class="clear"></div>
        <div class="postDesc">posted @ 2024-12-24 22:31
Timmoc
<span data-post-id="18628835" class="post-view-count">阅读(8)</span> 
<span data-post-id="18628835" class="post-comment-count">评论(0)</span> 
<span data-post-id="18628835" class="post-digg-count">推荐(0)</span> 
<a href="https://i.cnblogs.com/EditPosts.aspx?postid=18628835" rel="nofollow">
    编辑
</a>
</div>
        <div class="clear"></div>
            <div class="postSeparator"></div>
        <div class="postTitle" role="heading" aria-level="2">
            <a class="postTitle2 vertical-middle" href="https://www.cnblogs.com/timmoc/p/18628814">
    <span>
        图片上传
    </span>
    

</a>
        </div>
        <div class="postCon">

<div class="c_b_p_desc" id="postlist_description_18628814">
摘要：        
图片上传贴 由于博客园的文件上传只有100M，而图片上传单张图片最大2M 那就上传到随笔好了，图片本身是网络图片，因此并不担心公开问题。 但是图片的链接需要保证我还在使用博客园的期间有效，所以不想引用外链。 以下图片将成为初始的随机图列表，刚好挺适合的。 图片 ![image](https://im    <a href="https://www.cnblogs.com/timmoc/p/18628814" class="c_b_p_desc_readmore">阅读全文</a>
</div>

</div>
        <div class="clear"></div>
        <div class="postDesc">posted @ 2024-12-24 22:17
Timmoc
<span data-post-id="18628814" class="post-view-count">阅读(3)</span> 
<span data-post-id="18628814" class="post-comment-count">评论(0)</span> 
<span data-post-id="18628814" class="post-digg-count">推荐(0)</span> 
<a href="https://i.cnblogs.com/EditPosts.aspx?postid=18628814" rel="nofollow">
    编辑
</a>
</div>
        <div class="clear"></div>
            <div class="postSeparator"></div>
        <div class="postTitle" role="heading" aria-level="2">
            <a class="postTitle2 vertical-middle" href="https://www.cnblogs.com/timmoc/p/18628779">
    <span>
        国产AI使用尝试
    </span>
    

</a>
        </div>
        <div class="postCon">

<div class="c_b_p_desc" id="postlist_description_18628779">
摘要：        
豆包AI使用体验 不得不说现在AI的能力也是越来越离谱了。 上一篇博客 的代码是我写的，但是懒得写文章了，让AI替我生成一篇，这个质量我没话说。 完全可以以假乱真了，但是具体的细节、上下文链接、逻辑问题，还有待检查。 我只修改了可能侵犯版权的部分，具体的文章可以直接跳转上一篇博客。 两全其美的解决方    <a href="https://www.cnblogs.com/timmoc/p/18628779" class="c_b_p_desc_readmore">阅读全文</a>
</div>

</div>
        <div class="clear"></div>
        <div class="postDesc">posted @ 2024-12-24 21:52
Timmoc
<span data-post-id="18628779" class="post-view-count">阅读(3)</span> 
<span data-post-id="18628779" class="post-comment-count">评论(0)</span> 
<span data-post-id="18628779" class="post-digg-count">推荐(0)</span> 
<a href="https://i.cnblogs.com/EditPosts.aspx?postid=18628779" rel="nofollow">
    编辑
</a>
</div>
        <div class="clear"></div>
            <div class="postSeparator"></div>
        <div class="postTitle" role="heading" aria-level="2">
            <a class="postTitle2 vertical-middle" href="https://www.cnblogs.com/timmoc/p/18628757">
    <span>
        ibiquge 小说下载
    </span>
                    <img src="/images/visibility_off.svg" class="text-tail-icon" title="博文审核未通过，仅博主本人可见，如您认为是误判，请联系 contact@cnblogs.com 申请重新审核" alt="仅自己可见" />


</a>
        </div>
        <div class="postCon">

<div class="c_b_p_desc" id="postlist_description_18628757">
摘要：        
一、引言 在当今的网络文学世界中，ibiquge作为一个广为人知的平台，拥有着海量的小说资源，深受广大读者的喜爱。然而，对于一些读者来说，他们可能希望能够将自己喜欢的小说保存下来，以便在没有网络的情况下也能随时阅读。这时候，爬虫技术就可以派上用场了。通过编写爬虫程序，我们可以从ibiquge上抓取小    <a href="https://www.cnblogs.com/timmoc/p/18628757" class="c_b_p_desc_readmore">阅读全文</a>
</div>

</div>
        <div class="clear"></div>
        <div class="postDesc">posted @ 2024-12-24 21:41
Timmoc
<span data-post-id="18628757" class="post-view-count">阅读(2)</span> 
<span data-post-id="18628757" class="post-comment-count">评论(0)</span> 
<span data-post-id="18628757" class="post-digg-count">推荐(0)</span> 
<a href="https://i.cnblogs.com/EditPosts.aspx?postid=18628757" rel="nofollow">
    编辑
</a>
</div>
        <div class="clear"></div>
</div>



<div class="topicListFooter">
    <div id="nav_next_page">
        
    

    </div>    
</div>






<script>
    updatePostStats(
        $(".post-view-count").map(function () { return this.dataset.postId }).get(),
        function(id, count) { $(".post-view-count[data-post-id=" + id + "]").text("阅读(" + count + ")") },
        function(id, count) { $(".post-comment-count[data-post-id=" + id + "]").text("评论(" + count + ")") },
        function(id, count) { $(".post-digg-count[data-post-id=" + id + "]").text("推荐(" + count + ")") });
</script>
	</div><!--end: forFlow -->
	</div><!--end: mainContent 主体内容容器-->
	<div id="sideBar">
		<div id="sideBarMain">
			<div id="sidebar_news" class="newsItem">
    <h3 class="catListTitle">公告</h3>
<div id="blog-news">    
    <div id="sidebar_news_content">
    </div>
</div>
<script>loadBlogNews();</script>

 
</div>
<div id="sidebar_c3"></div>
			<div id="blog-calendar" style="display:none"></div><script>loadBlogDefaultCalendar();</script>			
			<div id="leftcontentcontainer">
				<div id="blog-sidecolumn"></div>
                    <script>loadBlogSideColumn();</script>
			</div>			
		</div><!--end: sideBarMain -->
	</div><!--end: sideBar 侧边栏容器 -->
	<div class="clear"></div>
	</div><!--end: main -->
	<div class="clear"></div>
	<div id="footer">
		<!--done-->
Copyright &copy; 2024 Timmoc
<br /><span id="poweredby">Powered by .NET 9.0 on Kubernetes</span>



	</div><!--end: footer -->
</div><!--end: home 自定义的最大容器 -->



    <div id="page_end_html">
        <!-- <script src="https://cdn.bootcss.com/fancybox/3.5.7/jquery.fancybox.js"></script>
<script src="https://cdn.bootcss.com/clipboard.js/2.0.4/clipboard.min.js"></script> -->

<script src="https://files.cnblogs.com/files/blogs/809481/vue.js?t=1735051820&download=true"></script>
<script src="https://files.cnblogs.com/files/blogs/809481/eui.css?t=1735051643&download=true"></script>
<script src="https://files.cnblogs.com/files/blogs/809481/jquery.cookie.js?t=1735051954&download=true"></script>
<!-- <script src="https://files.cnblogs.com/files/gshang/gs.js"></script> -->


<script>
    // 参数初始化
    var ele = new Vue({});
    var windowTop = 0;

    $(function () {
        // 基础组件初始化
        basicInit();
        // 其他初始化
        if ($("#topics").length > 0) {
            magicMarkdown(); // 魔法注释
            blogPostTitle(); // 博客正文标题背景图
            //imgCaption();
            ref();
            // $("#loading-container").fadeToggle("fast");
            postBasicSetting(); // 博客基本样式初始化
            // setSideContent(); // 侧边目录
            // contentActiveListen(); // 侧边目录滚动激活
            setCommet(); // 评论区
            initAuthor();
        } else {
            // entryPostTitle();  随笔分类背景图
            //  $("#loading-container").fadeToggle("fast");
        }
        // setProfile(); // 公告信息
        btnClick(); // 点击事件
        //copyCodeTip(); // 代码复制提示
        scrollListen(); // 滚动监听事件
        myscroll(); // 平滑滚动控制
        //

    });
    /* 初始化 */
    basicInit = function () {
        // 博客 favicon
        $("#favicon").replaceWith(
            '<link rel="shortcut icon" href="https://images.cnblogs.com/cnblogs_com/blogs/809481/galleries/2438117/o_241224150348_TD-ico.png">'
        );

        // 页脚
        //$('#mainContent').append($('#footer'));
        //消息红点
        msgDot();
        $('#mainContent').prepend($('#header'));

        // 初始化主题样式
        if ($.cookie("theme") == null) {
            $.cookie("theme", "dark", {
                expires: 30,
                path: "/",
                domain: "cnblogs.com",
            });
        }
        if ($.cookie("theme") == "dark") {
            document.documentElement.setAttribute("theme", "dark");
        } else {
            document.documentElement.setAttribute("theme", "light");
        }

        // 全屏黑幕
        $("#main").append('<div class="mask"></div>');

        // 侧边悬浮按钮
        $("#home").append(
            '<div class="float-btn"><ul>' +
            '<li class="btn-top"><a rel="nofollow noopener"  href="#top"></a></li>' +
            '<li class="btn-theme"><a rel="nofollow noopener"  href="javascript:changeTheme()"></a></li>' +
            // '<li class="btn-main"><a rel="nofollow noopener"  href="javascript:sidebarToggle()"></a></li>' +
            "</ul></div>"
        );
    };

    initAuthor = function () {
        const checkElement = function () {
            const target = document.querySelector('#author_profile_info');
            if (target) {
                console.log('元素找到了');
                target.innerHTML = `
                    <div class="author_profile_info" id="author_profile_info">
                            <a rel="nofollow noopener"  href="https://www.cnblogs.com/timmoc/" target="_blank">
                            <img alt="" class="author_avatar"
                            src="https://pic.cnblogs.com/avatar/3336551/20241224231122.png"></a>
                        <div class="author_profile_info" id="author_profile_detail">
                            <a rel="nofollow noopener"  href="https://home.cnblogs.com/timmoc/">Timmoc</a>
                            <br>
                            <a rel="nofollow noopener"  href="https://home.cnblogs.com/u/timmoc/followers/">粉丝 - <span class="follower-count">0</span></a>
                            <a rel="nofollow noopener"  href="https://home.cnblogs.com/u/timmoc/followees/">关注 - <span class="following-count">0</span></a><br>
                        </div>
                    </div>
                    `;
                clearInterval(timer);
            }
        };
        const timer = setInterval(checkElement, 100);
    }
    /* 魔法注释 */
    magicMarkdown = function () {
        // 添加 html 代码
        $("code.language-html").each(function () {
            if ($(this).text().split("\n")[0] == "<!-- run -->") {
                $("#cnblogs_post_body").append($(this).text());
                $(this).parent().remove();
            }
        });

        // 添加 js 代码
        $("code.language-html").each(function () {
            if ($(this).text().split("\n")[0] == "<!-- script -->") {
                $("head").append($(this).text());
                $(this).parent().remove();
            }
        });

        // 运行脚本
        $("code.language-js").each(function () {
            if ($(this).text().split("\n")[0] == "// run") {
                window.eval($(this).text());
                $(this).parent().remove();
            }
        });
    };


    // 参考文献
    function ref() {
        $(".footnote-ref a").each(function () {
            $(this).attr("title", $($(this).attr("href")).text().replace(/↩︎/g, ''));
        });
    }

    // 图注释文字
    function imgCaption() {

        $('.cnblogs-markdown p img').each(function () {
            if (typeof $(this).attr("alt") != "undefined") {
                if ($(this).attr("alt") != "") {
                    $(this)
                        .parent()
                        .after(
                            '<div class="img-caption">' + $(this).attr("alt") + "</div>"
                        );
                }
            }
        })
    }

    /* 按钮点击事件 */
    btnClick = function () {
        // 侧边开关
        $("#sidebar-toggler,.mask").click(function () {
            sidebarToggle();
        });
        // 移动端目录点击隐藏
        $(".nav a").click(function () {
            var w = document.body.clientWidth;
            if (w <= 1200) {
                sidebarToggle();
            }
        });
    };

    /* 博客正文标题背景图 */
    blogPostTitle = function () {
        if ($("#cnblogs_post_description .desc_img").length > 0) {
            $(".forFlow").before('<div class="post-header"></div>');
            $(".post-header").append($(".postTitle"));
            $(".post-header").append($(".postDesc"));
            $(".post-header").css(
                "background",
                "url(" + $("#cnblogs_post_description .desc_img").attr("src") + ")"
            );
        }
    };

    /* 随笔分类背景图 */
    entryPostTitle = function () {
        if ($(".entrylistDescription .desc_img").length > 0) {
            $("#mainContent").prepend('<div class="post-header"></div>');
            $(".post-header").append($(".entrylistTitle"));
            $(".post-header").append($(".entrylistDescription"));
            $(".post-header").css(
                "background",
                "url(" + $(".entrylistDescription .desc_img").attr("src") + ")"
            );
        }
    };

    /* 切换主题 */
    changeTheme = function () {
        if ($.cookie("theme") == "light") {
            $.cookie("theme", "dark", {
                expires: 30,
                path: "/",
                domain: "cnblogs.com",
            });
            document.documentElement.setAttribute("theme", "dark");
        } else {
            $.cookie("theme", "light", {
                expires: 30,
                path: "/",
                domain: "cnblogs.com",
            });
            document.documentElement.setAttribute("theme", "light");
        }
    };

    /* 侧边开关 */
    sidebarToggle = function () {
        $("body").toggleClass("main-widthout-sidebar");
    };

    /* 侧边显示 */
    showSide = function () {
        $("#sideBar").removeClass("content-active");
        $("#sideBar").addClass("side-active");
        $("#sideBar").scrollTop(0);
    };

    /* 目录显示 */
    showContent = function () {
        $("#sideBar").removeClass("side-active");
        $("#sideBar").addClass("content-active");
        contentScroll();

    };

    /* 平滑滚动控制 */
    myscroll = function () {
        $(".float-btn a[href*=\\#]").click(function () {
            if (
                location.pathname.replace(/^\//, "") ==
                this.pathname.replace(/^\//, "") &&
                location.hostname == this.hostname
            ) {
                var $target = $(this.hash);
                $target =
                    ($target.length && $target) || $("[name=" + this.hash.slice(1) + "]");
                if ($target.length) {
                    var targetOffset = $target.offset().top;
                    //
                    $("html,body").animate({
                            scrollTop: targetOffset - 0,
                        },
                        500
                    );

                    return false;
                }
                window.location.href = "#" + this.attr('id');
            }
        });
    };

    // 滚动监听事件
    scrollListen = function () {
        $(window).scroll(function () {
            var scrolls = $(this).scrollTop();
            if (scrolls >= windowTop) {
                //当scrolls>windowTop时，表示页面在向下滑动
                $(".float-btn").addClass("float-btn-hide");
                // if ($("#topics").length > 0 && scrolls > $(".postTitle").offset().top) {
                // $("#header").addClass("header-hidde");
                //}
                windowTop = scrolls;
            } else {
                $(".float-btn").removeClass("float-btn-hide");
                // $("#header").removeClass("header-hidde");
                windowTop = scrolls;
            }
        });
    };

    postBasicSetting = function () {
        // 代码高亮
        // $("pre code").each(function(i, block) {
        //     hljs.highlightBlock(block);
        // });

        // // 表格滚动
        // $("table").each(function() {
        //     $(this).css("cssText", "width:100%!important;display:table;");
        //     $(this).wrapAll('<div class="tablebox"></div>');
        //     $(".tablebox").css("overflow", "auto");
        // });

        // 新窗口打开链接
        $('#cnblogs_post_body a[href^="http"]').each(function () {
            $(this).attr("target", "_blank");
        });
        // 侧边悬浮评论按钮
        $(".btn-main").before(
            '<li class="btn-comment"><a rel="nofollow noopener"  href="#comment_form_container"></a></li>'
        );

        // 博客标题向下滚动显示
        /*
            $("#header").append(
              '<div class="post-navbar"><div class="post-title"></div>'
            );
            $(".post-title").text($(".postTitle span").text());
        */
        // 图片查看器
        // fancyBox($(".cnblogs-markdown img"));

        // 代码复制
        //codeCopy($("pre"), "post");
    };

    // 图片查看器
    fancyBox = function (Img) {
        // $(".cnblogs-markdown img")
        Img.each(function () {
            var element = document.createElement("a");
            $(element).attr("data-fancybox", "gallery");
            $(element).attr("href", $(this).attr("src"));
            $(element).attr("data-caption", $(this).attr("alt"));
            $(this).wrap(element);
            if (typeof $(this).attr("alt") != "undefined") {
                if ($(this).attr("alt") != "") {
                    $(this)
                        .parent()
                        .after(
                            '<div class="img-caption">' + $(this).attr("alt") + "</div>"
                        );
                }
            }
        });
    };

    /* 代码复制 */
    codeCopy = function (codeElement, prefix) {
        // 代码复制按钮
        for (i = 0; i <= codeElement.length; i++) {
            codeElement.eq(i).wrapAll('<div class="copyItem"></div>');
            $(".copyItem").css("position", "relative");

            if (codeElement.eq(i).children("code").length > 0) {
                var codeType = codeElement
                    .eq(i)
                    // .children("code")
                    .attr("class")
                    // .split(" ")[0]
                    .split("-")[1];
                if (codeType == null) {
                    codeType = "";
                } else {
                    codeType = codeType.toLowerCase();
                }
                codeElement
                    .eq(i)
                    .before('<div class="codeType">' + codeType + "</div>");
            }

            codeElement
                .eq(i)
                .before(
                    '<div class="clipboard-button" id="copy_btn_' +
                    i +
                    ' " data-clipboard-target="#' +
                    prefix +
                    "_copy_target_" +
                    i +
                    '"title="复制"></div>'
                );
            codeElement.eq(i).attr("id", prefix + "_copy_target_" + i);
        }

        codeElement.children("code").each(function () {
            var lines = $(this).text().split("\n").length - 1;
            var $numbering = $("<ul/>").addClass("pre-numbering");
            $(this).addClass("has-numbering").parent().append($numbering);
            for (i = 1; i <= lines; i++) {
                $numbering.append($("<li/>").attr("data-number", i));
            }
        });
    };

    /* 代码复制提示 */
    copyCodeTip = function () {
        var clipboard = new ClipboardJS(".clipboard-button");
        clipboard.on("success", function (e) {
            ele.$message({
                showClose: true,
                message: "代码复制成功！",
                duration: 1000,
                type: "success",
            });
            e.clearSelection();
        });
        clipboard.on("error", function (e) {
            ele.$message({
                showClose: true,
                message: "代码复制失败！",
                duration: 1000,
                type: "error",
            });
            e.clearSelection();
        });
    };

    /* owo 表情包插件 */
    /*
    owoEmoji = function() {
        $(".commentbox_footer").prepend(
            '<div class="OwO" onclick="load_face(this)"><div class="OwO-logo"><i class="fa fa-smile-o" aria-hidden="true"></i></div></div>'
        );
        // 表情按钮按下
        load_face = function(b) {
            var c = new OwO({
                logo: '<i class="fa fa-smile-o" aria-hidden="true"></i>',
                container: document.getElementsByClassName("OwO")[0],
                target: document.getElementById("tbCommentBody"),
                api: "https://cdn.jsdelivr.net/gh/gshang2018/home/gshang.owo.json",
                position: "up",
                width: "100%",
                maxHeight: "250px",
            });
            b.classList.add("OwO-open");
            b.onclick = null;
        };
    };*/

    /* 侧边目录滚动激活 */
    contentActiveListen = function () {
        //开启滚动监听, 监听所有在.nav类下的li
        // var top_offset = 60;
        // $("body").scrollspy({
        //     offset: top_offset, // 偏置80，防止遮挡
        // });
        $(window).scroll(function () {
            if ($('#sideBar').hasClass('content-active')) {
                contentScroll();
            }
        });
    };

    contentScroll = function () {
        var now = $("#sidebar_scroller").find(".active");
        var basicHeight = now.outerHeight();
        var prevNum = now.prevAll().length + 1;
        var top_distance = prevNum * basicHeight - 60;
        $("#sideBar").scrollTop(top_distance);
    }
    msgDot = function () {
        $(document).ajaxComplete(function (event, xhr, option) {
            if ($('#msg_count').text() != "") {
                $("#blog_nav_contact").addClass("has_msg");
            }
        })
    }
    /* 侧边目录 */
    setSideContent = function () {
        var $ph = $("#cnblogs_post_body :header:eq(0)");
        if ($ph.length > 0) {
            //设置层级为1
            $ph.attr("offset", "1");
            //添加导航目录的内容
            $("#sideBar").prepend(
                '<div id="sidebar_scroller" class="sidebar-block"><ul class="nav"></ul></div>'
            );
            $("#sideBar").prepend(
                '<div class="side-choose"><a rel="nofollow noopener"  id="myside" href="javascript:showSide()">侧边</a><a rel="nofollow noopener"  id="mycontent" href="javascript:showContent()">大纲</a></div>'
            );
            $("#sideBarMain").hide();
            showContent();
            //遍历文章里每个h标签
            $("#cnblogs_post_body :header").each(function (i) {
                var $h = $(this);
                //设置h标签的id, 编号从0开始

                // $h.append('<a rel="nofollow noopener"  class="title-link" id="scroller-' + i + '" href="#' + $h.attr("id") + '"></a>');
                $h.attr("class", "title-parent");
                //比上一个h标签层级小, 级数加1
                if ($h[0].tagName > $ph[0].tagName) {
                    $h.attr("offset", parseInt($ph.attr("offset")) + 1);
                } //比上一个h标签层级大, 级数减1
                else if ($h[0].tagName < $ph[0].tagName) {
                    var h = parseInt($h[0].tagName.substring(1));
                    var ph = parseInt($ph[0].tagName.substring(1));

                    var offset = parseInt($ph.attr("offset")) - (ph - h);
                    if (offset < 1) {
                        offset = 1;
                    }
                    $h.attr("offset", offset);
                } //和上一个h标签层级相等时, 级数不变
                else {
                    $h.attr("offset", $ph.attr("offset"));
                }
                //添加h标签的目录内容
                $("#sidebar_scroller ul").append(
                    '<li class="scroller-offset' +
                    $h.attr("offset") +
                    '"><a rel="nofollow noopener"  href="#' +
                    $h.attr("id") +
                    '" title="' + $h.text() + '">' +
                    $h.text() +
                    "</a></li>"
                );
                //最后设置自己为上一个h标签
                $ph = $h;
            });
            // contentActiveListen(); // 侧边目录滚动激活
        }
    };

    /* 评论区 */
    setCommet = function () {
        $(document).ajaxComplete(function (event, xhr, option) {
            //评论头像
            if (option.url.indexOf("GetComments") > -1) {
                setTimeout(function () {
                    // 表情包

                    // 头像
                    $.each($(".feedbackItem"), function (index, ele) {
                        var self = $(ele);
                        var obj = self.find(".blog_comment_body");
                        var id = obj.attr("id").split("_")[2];
                        var blog = self.find('a[id^="a_comment_author"]');
                        var blogUrl = blog.attr("href");
                        var imgSrc =
                            $("#comment_" + id + "_avatar").html() ||
                            "http://pic.cnblogs.com/avatar/simple_avatar.gif";
                        self.prepend(
                            '<a rel="nofollow noopener"  class="comment_avatar_container" href="' +
                            blogUrl +
                            '"><img src="' +
                            imgSrc +
                            '" style="float:left;" class="comment_avatar"></a'
                        );
                        $(".feedbackListSubtitle").addClass("feedbackListSubtitle_right");
                        $(".feedbackCon").addClass("feedbackCon_right");
                    });

                    // 代码复制
                    //codeCopy($("#blog-comments-placeholder pre"));
                    // 图片查看器
                    //fancyBox($(".blog_comment_body img"), "comment");
                }, 300);
            }
        });
    };
</script>
    </div>

    <input type="hidden" id="antiforgery_token" value="CfDJ8DfB03_iObVLoqH7ndAeeDj8XAY7Ba2k9bA9iRcdEoE-Le4Av0kEsqinqDRJkXMJHBrI6a0cx9lLvkf64D4asOkpYhQH6KCRj4RtJBJiL8FQWnT6S2pEM5Nh4W8OOnNpKjSCgFsR31jadMB2ZBEMtecI0RENKYEvqyxC3qEMZLRSXji5MKvg2yjeWorFSGjy_Q" />
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-M95P3TTWJZ"></script>
<script>
    window.dataLayer = window.dataLayer || [];
    function gtag() { dataLayer.push(arguments); }
    gtag('js', new Date());
    gtag('config', 'G-M95P3TTWJZ');
</script>
<script defer src="https://hm.baidu.com/hm.js?866c9be12d4a814454792b1fd0fed295"></script>
    <script type="module" src="/src/article/article.js"></script>
</body>
</html>
